package com.chaos.payment.service.pay;

import com.chaos.payment.service.pay.ali.AliPayApi;
import com.chaos.payment.service.pay.balance.BalancePayApi;
import com.chaos.payment.service.pay.wx.WxPayApi;
import com.chaos.order.api.dto.pay.request.PayRequest;
import com.chaos.order.api.dto.pay.request.RefundRequest;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;

/**
 * @description:
 * @author: crayon
 * @time: 2024/6/17 18:17
 */
@Component
@RequiredArgsConstructor
public class PayClient {


    private final WxPayApi wxPayApi;
    private final AliPayApi aliPayApi;
    private final BalancePayApi balancePayApi;

    public AbstractPay<PayRequest, RefundRequest> getPayApi(Integer payType){
        switch (payType){
            case 1:
                return aliPayApi ;
            case 2:
                return wxPayApi ;
            case 3:
                return balancePayApi ;
            default:
                throw new RuntimeException("支付类型错误");
        }
    }
}
